package com.sxbbc.common.core.enums;

import com.sxbbc.common.basics.utils.calculation.CalcuUtils;
import java.util.ArrayList;
import java.util.List;

/**
 * 活动相关 支付或红包中的类型
 * 如 红包中为余额、积分等
 *
 * @author leehao
 * @date 2019-06-10
 */
public enum ActivityPayEnums {
    MONEY(1, "余额",true),
    POINT(2, "积分",false),
    DONATE(3, "贡献值",true),
    SHARE(4, "共享值",true);

    private Integer id;
    private String name;
    private boolean valid;

    ActivityPayEnums(Integer id, String name,boolean valid) {
        this.id = id;
        this.name = name;
        this.valid = valid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public boolean isValid() {
        return valid;
    }

    public void setValid(boolean valid) {
        this.valid = valid;
    }

    public static List<ActivityPayEnums> queryList() {
        List<ActivityPayEnums> list = new ArrayList<ActivityPayEnums>();
        for (ActivityPayEnums o : ActivityPayEnums.values()) {
            if (o.isValid()) {
                list.add(o);
            }
        }
        return list;
    }

    public static String getName(Integer id) {
        String str = "";
        for (ActivityPayEnums o : ActivityPayEnums.values()) {
            if (CalcuUtils.getInstance().isEquals(id, o.getId())) {
                str = o.getName();
                break;
            }
        }
        return str;
    }
}
